package initialize

import (
	"context"

	"github.com/flipped-aurora/gin-vue-admin/server/global"
	"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva_intelligent_form/model"
	"go.uber.org/zap"
)

func Gorm(ctx context.Context) {
	err := global.GVA_DB.AutoMigrate(
		&model.IntelligentForm{},
		&model.IntelligentFormField{},
		&model.IntelligentFormSubmission{},
		&model.IntelligentFormTemplate{},
	)
	if err != nil {
		global.GVA_LOG.Error("智能表单插件数据库迁移失败!", zap.Error(err))
	} else {
		global.GVA_LOG.Info("智能表单插件数据库迁移成功!")
	}
}
